//
//  RegisteredView.m
//  mhome
//
//  Created by YaSha_Tom on 2018/12/1.
//  Copyright © 2018年 刘春雷. All rights reserved.
//

#import "RegisteredView.h"
#import "UIButton+CountDown.h"

@implementation RegisteredView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(0, 0, kSCREEN_WIDTH, kSCREEN_HEIGHT);
        [self initUI];
    }
    return self;
}

- (void)initUI {
    _phoneTextField = [[TextFileld alloc] init];
    [_phoneTextField setImageName:@"账户" placeholder:@"请输入您的工号"];
    _phoneTextField.text = [[NSUserDefaults standardUserDefaults] objectForKey:@"account"];
    [self addSubview:_phoneTextField];
    [_phoneTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.mas_top).offset(kTopHeight+20);
        make.left.mas_equalTo(self.mas_left).offset(25);
        make.right.mas_equalTo(self.mas_right).offset(-25);
        make.height.mas_equalTo(50*kHeightScale);
    }];
    
    _getCaptchaButton = [[UIButton alloc] init];
    _getCaptchaButton.layer.masksToBounds = YES;
    _getCaptchaButton.layer.cornerRadius = 5;
    _getCaptchaButton.titleLabel.font = [UIFont systemFontOfSize:16];
    [_getCaptchaButton setTitle:@"获取手机验证码" forState:UIControlStateNormal];
    [self addSubview:_getCaptchaButton];
    [_getCaptchaButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_phoneTextField.mas_bottom).offset(30);
        make.right.mas_equalTo(_phoneTextField.mas_right);
        make.size.mas_equalTo(CGSizeMake(140*kWidthScale, 40*kHeightScale));
    }];
    
    _captchaTextField = [[TextFileld alloc] init];
    _captchaTextField.keyboardType = UIKeyboardTypeNumberPad;
    [_phoneTextField setImageName:@"验证码" placeholder:@"请输入验证码"];
    [self addSubview:_captchaTextField];
    [_captchaTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_phoneTextField.mas_bottom).offset(25);
        make.left.mas_equalTo(_phoneTextField.mas_left);
        make.right.mas_equalTo(_getCaptchaButton.mas_left);
        make.height.mas_equalTo(50*kHeightScale);
    }];
    
    _nextButton = [[UIButton alloc]init];
    [_nextButton setTitle:@"下一步" forState:UIControlStateNormal];
    [self addSubview:_nextButton];
    [_nextButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self);
        make.top.mas_equalTo(_captchaTextField.mas_bottom).offset(50);
        make.size.mas_equalTo(CGSizeMake(300*kWidthScale, 50*kHeightScale));
    }];
}

@end
